package course.view;

import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.GridLayout;
<<<<<<< HEAD
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.File;
import java.io.IOException;
import java.util.List;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JSplitPane;
import javax.swing.JTextField;
import course.controller.CourseControllerListener;
import course.po.Student;
import course.po.Teacher;
import course.service.impl.CourseServiceImpl;

public class TeacherFrame extends JFrame {
	private static final long serialVersionUID = 7971611100316550468L;
	private static CourseControllerListener controllerListener;
	public CourseServiceImpl courseService;
	public static int isbn = -1;// 选中的表格行索引
	public static JScrollPane tablePanel;
	public static JScrollPane tablePanel1;
	public static JScrollPane tablePanel2;
	public static JComboBox<String> comboBox1;
	public static JComboBox<String> comboBox2;
	private String accountName ;
	public static JPanel p1;
	public static JPanel p2;
	private JPanel p3;
	private JPanel p4;
	private JPanel p5;
	private JPanel p6;
	private JPanel p7;
	private JPanel p8;
	private JPanel p9;
	private JPanel p10;
	private JPanel p11;
	private JPanel p12;
	private JPanel p13;
	private JPanel p14;
	private JPanel p15;
	private JPanel p16;
	private JPanel p17;
	private JPanel p18;
	private JPanel p19;
	private static JPanel p21;
	private static JPanel p22;
	private static JPanel p20;
	private static JPanel p23;
	private static JPanel p24;
	public JPanel p25;
	public JPanel p0;
	private LoginFrame loginFrame;
	private JScrollPane tablePanel3;
	private JTextField t1_1;
	public static JTextField t1;
	public static JTextField t2;
	public TeacherFrame() {
		this.controllerListener = new CourseControllerListener();
		this.controllerListener.setTeacherFrame(this);
		JSplitPane sp1 = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
		JSplitPane sp2 = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);
		JSplitPane sp3 = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
		JSplitPane sp4 = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
		p1 = new JPanel();
		p2 = new JPanel();
		p3 = new JPanel();
		p4 = new JPanel();
		p5 = new JPanel();
		p6 = new JPanel();
		p7 = new JPanel();
		p8 = new JPanel();
		p9 = new JPanel();
		p10 = new JPanel();
		p11 = new JPanel();
		p12 = new JPanel();
		p13 = new JPanel();
		courseService = new CourseServiceImpl();
		accountName = courseService.getTeacher(CourseControllerListener.nameInput).getTeaName();
		JLabel s1 = new JLabel("欢迎您！");
		JLabel s2 = new JLabel(accountName + "老师");
		JButton b1 = new JButton("个人信息");
		b1.addActionListener(controllerListener);
		b1.setActionCommand("teacherData");
		JButton b2 = new JButton("所开课程");
		b2.addActionListener(controllerListener);
		b2.setActionCommand("courseList");
		JButton b3 = new JButton("选修名单");
		b3.addActionListener(controllerListener);
		b3.setActionCommand("studentList");
		JButton b4 = new JButton("成绩录入、修改");
		b4.addActionListener(controllerListener);
		b4.setActionCommand("suGrade");
		JButton b5 = new JButton("成绩查询");
		b5.addActionListener(controllerListener);
		b5.setActionCommand("researchGrade");
		JButton b6 = new JButton("退出系统");
		b6.addActionListener(controllerListener);
		b6.setActionCommand("gobackT");
		sp1.setDividerLocation(100);
		sp1.setDividerSize(8);
		sp2.setLeftComponent(sp4);
		sp2.setRightComponent(p2);// 右部显示界面
		sp2.setDividerLocation(250);
		sp2.setDividerSize(8);
		sp2.setOneTouchExpandable(true);
		sp2.setContinuousLayout(true);
		sp1.setRightComponent(sp2);
		this.add(sp1);
		sp3.setLeftComponent(p3);
		sp3.setRightComponent(p4);
		sp3.setDividerLocation(250);
		sp3.setDividerSize(8);
		sp3.setOneTouchExpandable(true);
		sp3.setContinuousLayout(true);
		sp4.add(sp3);
		p3.setLayout(new GridLayout(2, 1));
		p3.add(p5);
		p3.add(p6);
		s1.setFont(new Font("Dialog", 1, 25));
		s2.setFont(new Font("Dialog", 1, 25));
		p6.add(s1);
		p6.add(s2);
		p4.setLayout(new GridLayout(6, 1));
		p4.add(p8);
		p4.add(p9);
		p4.add(p10);
		p4.add(p11);
		p4.add(p12);
		p4.add(p13);
		b1.setPreferredSize(new Dimension(150, 30));
		b2.setPreferredSize(new Dimension(150, 30));
		b3.setPreferredSize(new Dimension(150, 30));
		b4.setPreferredSize(new Dimension(150, 30));
		b5.setPreferredSize(new Dimension(150, 30));
		b6.setPreferredSize(new Dimension(150, 30));
		p8.add(b1);
		p9.add(b2);
		p10.add(b3);
		p11.add(b4);
		p12.add(b5);
		p13.add(b6);
		this.setTitle("选课管理系统——教师1");
		this.setSize(1000, 800);
		this.setResizable(false);
		this.setLocationRelativeTo(null);
		this.validate();
		this.setVisible(true);
	}
    //教师界面
	public void drawTeacher() {
		p13 = new JPanel();
		p14 = new JPanel();
		p15 = new JPanel();
		p16 = new JPanel();
		p17 = new JPanel();
		p18 = new JPanel();
		p19 = new JPanel();
		p2.removeAll();
		p2.repaint();
		courseService = new CourseServiceImpl();
		Teacher tea =courseService.getTeacher(CourseControllerListener.nameInput);
		p2.setLayout(new GridLayout(8, 1));
		p2.add(p13);
		p2.add(p14);
		p2.add(p15);
		p2.add(p16);
		p2.add(p17);
		p2.add(p18);
		p2.add(p19);
		JLabel person1 = new JLabel("教职工号：" + tea.getTeaNo());
		JLabel person2 = new JLabel("姓名：" +  tea.getTeaName());
		JLabel person3 = new JLabel("性别：" +  tea.getTeaSex());
		JLabel person4 = new JLabel("年龄：" +  tea.getTeaAge());
		JLabel person5 = new JLabel("课程编号：" +tea.getCourse().getCouId());
		JLabel person6 = new JLabel("所教科目：" + tea.getCourse().getCouName());
		person1.setFont(new Font("Dialog", 1, 25));
		person2.setFont(new Font("Dialog", 1, 25));
		person3.setFont(new Font("Dialog", 1, 25));
		person4.setFont(new Font("Dialog", 1, 25));
		person5.setFont(new Font("Dialog", 1, 25));
		person6.setFont(new Font("Dialog", 1, 25));
		p14.add(person1);
		p15.add(person2);
		p16.add(person3);
		p17.add(person4);
		p18.add(person5);
		p19.add(person6);
		p2.revalidate();
	}	

	// 教师查看学生成绩界面
	public void getStudentGrade(List<Student> list) {
		p2.removeAll();
		p2.repaint();
		p2.setLayout(new GridLayout(2, 1));
	
		//p1.setLayout(new BorderLayout());
		tablePanel1=StudentJPanel.getStudentTablePanel(list);
		p2.add(tablePanel1);
		//p2.add(p1);
		System.out.println(2222222);
	
		// p1.add(TzJPanel.getCourseTablePanel(controllerListener.getCourseService().getStudentGrade(stuNo)));
//		p1.add(StudentJPanel.getStudentTablePanel(controllerListener.getCourseService().findAllStudent()));
		JButton b6 = new JButton("查询");
		b6.addActionListener(controllerListener);
		b6.setActionCommand("researchStuGrade");
		JButton b7 = new JButton("查询");
		b7.addActionListener(controllerListener);
		b7.setActionCommand("confirmMax");
	   	   JButton b8 = new JButton("Export:导出成绩单");
    	   b8.addActionListener(new ActionListener() {
    		   public void actionPerformed(ActionEvent evt) {
    			   try {
    				   ImportExcel exp = new ImportExcel();
    				   exp.ImportExcel(StudentJPanel.getStudentTable(list), new File("C:\\Users\\yangliping\\Desktop\\studentGrade.xls"));
    			   } catch (IOException ex) {
    				   System.out.println(ex.getMessage());
    				   ex.printStackTrace();
    			   }
    		   }
    	   });
    	 
    	   JButton b9 = new JButton("Inport:下载成绩单");
    	   b8.addActionListener(new ActionListener() {
    		   public void actionPerformed(ActionEvent evt) {
    			   try {
    				   java.awt.Desktop.getDesktop().open(new File("C:\\Users\\yangliping\\Desktop\\studentGrade.xls"));
    			   } catch (IOException ex) {
    				   System.out.println(ex.getMessage());
    				   ex.printStackTrace();
    			   }
    		   }
    	   });
    	 
       
		JLabel s2 = new JLabel("类型：");
		JLabel s3 = new JLabel("类型：");
		comboBox1 = new JComboBox<String>();// 创建一个下拉列表框comboBox1
		comboBox1.addItem("班级号");
		comboBox1.addItem("学号");
		comboBox1.addItem("课程名称");
		comboBox2 = new JComboBox<String>();// 创建一个下拉列表框comboBox2
		comboBox2.addItem("最高分");
		comboBox2.addItem("最低分");
		comboBox2.addItem("平均分");
		comboBox2.addItem("成绩统计");
		p20 = new JPanel();
		p21 = new JPanel();
		p22 = new JPanel();
		p23 = new JPanel();
		p24 = new JPanel();
		p25 = new JPanel();
		p20.setLayout(new GridLayout(5, 1));
		p2.add(p20);
		p20.add(p21);
		p20.add(p22);
		p20.add(p23);
		p20.add(p24);
		p20.add(p25);
		s2.setFont(new Font("Dialog", 1, 25));
		s3.setFont(new Font("Dialog", 1, 25));
		t1 = new JTextField(12);
		t2 = new JTextField(12);
		p21.add(s2);
		p22.add(t1);
		p22.add(comboBox1);
		p22.add(b6);
		p23.add(s3);
		p24.add(t2);
		p24.add(comboBox2);
		p24.add(b7);
		p25.add(b8);
		p2.revalidate();
	}
    //老师查看所教课程界面
	public void getTeaCou(String teaNo) {
		p2.removeAll();
		p2.repaint();
		p2.setLayout(new GridLayout(2, 1));
		//p1.setLayout(new BorderLayout());
		tablePanel2=CourseJPanel.getCourseTablePanel(controllerListener.getCourseService().getTeaCourse(teaNo));
        p2.add(tablePanel2);
        //p2.add(p1);
		JButton b6 = new JButton("查询");
		b6.addActionListener(controllerListener);
		b6.setActionCommand("timeCourse");
		JLabel s2 = new JLabel("输入时间/地点：");
		p0 = new JPanel();
		p20 = new JPanel();
		p21 = new JPanel();
		p22 = new JPanel();	
		p20.setLayout(new GridLayout(4, 1));
		p2.add(p20);
		p20.add(p0);
		p20.add(p21);
		p20.add(p22);	
		s2.setFont(new Font("Dialog", 1, 25));
		 t1 = new JTextField(12);
		 p21.add(s2);
		p22.add(t1);p22.add(b6); 
		p2.revalidate();
	}
	//老师查看所教课程时间界面
		public void getTimeCou(String time,String teaNo) {
			p2.removeAll();
			p2.repaint();
			p2.setLayout(new GridLayout(2, 1));
			//p1.setLayout(new BorderLayout());
			tablePanel2=CourseJPanel.getCourseTablePanel(controllerListener.getCourseService(). getTimeCourse(time,teaNo));
	        p2.add(tablePanel2);
	        //p2.add(p1);
			JButton b6 = new JButton("查询");
			b6.addActionListener(controllerListener);
			b6.setActionCommand("timeCourse");
			JLabel s2 = new JLabel("输入时间/地点：");
			p0 = new JPanel();
			p20 = new JPanel();
			p21 = new JPanel();
			p22 = new JPanel();	
			p20.setLayout(new GridLayout(4, 1));
			p2.add(p20);
			p20.add(p0);
			p20.add(p21);
			p20.add(p22);	
			s2.setFont(new Font("Dialog", 1, 25));
			 t1 = new JTextField(12);
			 p21.add(s2);
			p22.add(t1_1);p22.add(b6); 
			p2.revalidate();
		}
	//选修名单
	public void getClaCou(String teaNo) {
		p2.removeAll();
		p2.repaint();
		p2.setLayout(new GridLayout(2, 1));
		//p1.setLayout(new BorderLayout());
		tablePanel3=StudentJPanel.getStudentTablePanel(controllerListener.getCourseService().findTeaStu(teaNo));
        p2.add(tablePanel3);
        //p2.add(p1);
		JButton b6 = new JButton("查询");
		b6.addActionListener(controllerListener);
		b6.setActionCommand("classNo");
		JLabel s2 = new JLabel("输入专业名称：");
		p0 = new JPanel();
		p20 = new JPanel();
		p21 = new JPanel();
		p22 = new JPanel();	
		p20.setLayout(new GridLayout(4, 1));
		p2.add(p20);
		p20.add(p0);
		p20.add(p21);
		p20.add(p22);	
		s2.setFont(new Font("Dialog", 1, 25));
		 t1_1 = new JTextField(12);
		 p21.add(s2);
		p22.add(t1_1);p22.add(b6); 
		p2.revalidate();
	}
	//根据专业选修名单
		public void getCourseMaj(String major,String teaNo) {
			p2.removeAll();
			p2.repaint();
			p2.setLayout(new GridLayout(2, 1));
			//p1.setLayout(new BorderLayout());
			tablePanel3=StudentJPanel.getStudentTablePanel(controllerListener.getCourseService().getCourseMajGrade(major,teaNo));
	        p2.add(tablePanel3);
	        //p2.add(p1);
			JButton b6 = new JButton("查询");
			b6.addActionListener(controllerListener);
			b6.setActionCommand("classNo");
			JLabel s2 = new JLabel("输入班级号：");
			p0 = new JPanel();
			p20 = new JPanel();
			p21 = new JPanel();
			p22 = new JPanel();	
			p20.setLayout(new GridLayout(4, 1));
			p2.add(p20);
			p20.add(p0);
			p20.add(p21);
			p20.add(p22);	
			s2.setFont(new Font("Dialog", 1, 25));
			 t1_1 = new JTextField(12);
			 p21.add(s2);
			p22.add(t1);p22.add(b6); 
			p2.revalidate();
		}
    //教师录入、修改学生成绩界面
	public void getTeaStu(String teaNo) {
		p2.removeAll();
		p2.repaint();
		p2.setLayout(new GridLayout(2, 1));
//		p2.add(p1);
		//p1.setLayout(new BorderLayout());
		// p1.add(TzJPanel.getCourseTablePanel(controllerListener.getCourseService().getStudentGrade(stuNo)));
		tablePanel = StudentJPanel.getStudentTablePanel(controllerListener.getCourseService().findTeaStu(teaNo));
		p2.add(tablePanel);
	
		JButton b6 = new JButton("成绩录入");
		b6.addActionListener(controllerListener);
		b6.setActionCommand("recGrade");

		JButton b7 = new JButton("确认修改");
		b7.addActionListener(controllerListener);
		b7.setActionCommand("confirmGrade");
		JLabel s2 = new JLabel("录入学生成绩：");
		JLabel s3 = new JLabel("修改学生成绩：");
		p20 = new JPanel();
		p21 = new JPanel();
		p22 = new JPanel();
		p23 = new JPanel();
		p24 = new JPanel();
		p20.setLayout(new GridLayout(4, 1));
		p2.add(p20);
		p20.add(p21);
		p20.add(p22);
		p20.add(p23);
		p20.add(p24);
		s2.setFont(new Font("Dialog", 1, 25));
		s3.setFont(new Font("Dialog", 1, 25));
		t1 = new JTextField(12);
		t2 = new JTextField(12);
		p21.add(s2);
		p22.add(t1);
		p22.add(b6);
		p23.add(s3);
		p24.add(t2);
		p24.add(b7);
		p2.revalidate();
	}

	public static void refreshGrade(List<Student> studentList) {
		System.out.println("测试——当前学生数量为：" + studentList.size());
		p2.removeAll();
		p2.add(StudentJPanel.getStudentTablePanel(studentList));

		JButton b6 = new JButton("成绩录入");
		b6.addActionListener(controllerListener);
		b6.setActionCommand("recGrade");

		JButton b7 = new JButton("确认修改");
		b7.addActionListener(controllerListener);
		b7.setActionCommand("confirmGrade");
		JLabel s2 = new JLabel("录入学生成绩：");
		JLabel s3 = new JLabel("修改学生成绩：");
		p20 = new JPanel();
		p21 = new JPanel();
		p22 = new JPanel();
		p23 = new JPanel();
		p24 = new JPanel();
		p20.setLayout(new GridLayout(4, 1));
		p2.add(p20);
		p20.add(p21);
		p20.add(p22);
		p20.add(p23);
		p20.add(p24);
		s2.setFont(new Font("Dialog", 1, 25));
		s3.setFont(new Font("Dialog", 1, 25));
		t1 = new JTextField(12);
		t2 = new JTextField(12);
		p21.add(s2);
		p22.add(t1);
		p22.add(b6);
		p23.add(s3);
		p24.add(t2);
		p24.add(b7);
		p2.revalidate();
=======
import java.util.List;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JSplitPane;
import javax.swing.JTextField;
import course.controller.CourseControllerListener;
import course.po.Student;
import course.po.Teacher;
import course.service.impl.CourseServiceImpl;

public class TeacherFrame extends JFrame {
	private static final long serialVersionUID = 7971611100316550468L;
	private static CourseControllerListener controllerListener;
	public CourseServiceImpl courseService;
	public static int isbn = -1;// 选中的表格行索引
	public static JScrollPane tablePanel;
	public static JScrollPane tablePanel1;
	public static JScrollPane tablePanel2;
	public static JComboBox<String> comboBox1;
	public static JComboBox<String> comboBox2;
	private String accountName = courseService.getTeacher(CourseControllerListener.nameInput).getTeaName();
	public static JPanel p1;
	private static JPanel p2;
	private JPanel p3;
	private JPanel p4;
	private JPanel p5;
	private JPanel p6;
	private JPanel p7;
	private JPanel p8;
	private JPanel p9;
	private JPanel p10;
	private JPanel p11;
	private JPanel p12;
	private JPanel p13;
	private JPanel p14;
	private JPanel p15;
	private JPanel p16;
	private JPanel p17;
	private JPanel p18;
	private JPanel p19;
	private JPanel p21;
	private JPanel p22;
	private JPanel p20;
	private JPanel p23;
	private JPanel p24;
	public JPanel p25;
	public static JTextField t1;
	public static JTextField t2;
	JSplitPane sp2;
	public TeacherFrame() {
		this.controllerListener = new CourseControllerListener();
		this.controllerListener.setTeacherFrame(this);
		JSplitPane sp1 = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
		 sp2 = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);
		JSplitPane sp3 = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
		JSplitPane sp4 = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
		p1 = new JPanel();
		p2 = new JPanel();
		p3 = new JPanel();
		p4 = new JPanel();
		p5 = new JPanel();
		p6 = new JPanel();
		p7 = new JPanel();
		p8 = new JPanel();
		p9 = new JPanel();
		p10 = new JPanel();
		p11 = new JPanel();
		p12 = new JPanel();
		JLabel s1 = new JLabel("欢迎您！");
		JLabel s2 = new JLabel(accountName + "老师");
		JButton b1 = new JButton("个人信息");
		b1.addActionListener(controllerListener);
		b1.setActionCommand("teacherData");
		JButton b2 = new JButton("所开课程");
		b2.addActionListener(controllerListener);
		b2.setActionCommand("courseList");
		JButton b3 = new JButton("选修名单");
		b3.addActionListener(controllerListener);
		b3.setActionCommand("studentList");
		JButton b4 = new JButton("成绩录入、修改");
		b4.addActionListener(controllerListener);
		b4.setActionCommand("suGrade");
		JButton b5 = new JButton("成绩查询");
		b5.addActionListener(controllerListener);
		b5.setActionCommand("researchGrade");
		sp1.setDividerLocation(100);
		sp1.setDividerSize(8);
		sp2.setLeftComponent(sp4);
		sp2.setRightComponent(p2);// 右部显示界面
		sp2.setDividerLocation(250);
		sp2.setDividerSize(8);
		sp2.setOneTouchExpandable(true);
		sp2.setContinuousLayout(true);
		sp1.setRightComponent(sp2);
		this.add(sp1);
		sp3.setLeftComponent(p3);
		sp3.setRightComponent(p4);
		sp3.setDividerLocation(250);
		sp3.setDividerSize(8);
		sp3.setOneTouchExpandable(true);
		sp3.setContinuousLayout(true);
		sp4.add(sp3);
		p3.setLayout(new GridLayout(2, 1));
		p3.add(p5);
		p3.add(p6);
		s1.setFont(new Font("Dialog", 1, 25));
		s2.setFont(new Font("Dialog", 1, 25));
		p6.add(s1);
		p6.add(s2);
		p4.setLayout(new GridLayout(5, 1));
		p4.add(p8);
		p4.add(p9);
		p4.add(p10);
		p4.add(p11);
		p4.add(p12);
		b1.setPreferredSize(new Dimension(150, 30));
		b2.setPreferredSize(new Dimension(150, 30));
		b3.setPreferredSize(new Dimension(150, 30));
		b4.setPreferredSize(new Dimension(150, 30));
		b5.setPreferredSize(new Dimension(150, 30));
		p8.add(b1);
		p9.add(b2);
		p10.add(b3);
		p11.add(b4);
		p12.add(b5);
		this.setTitle("选课管理系统——教师1");
		this.setSize(1000, 800);
		this.setResizable(false);
		this.setLocationRelativeTo(null);
		this.validate();
		this.setVisible(true);
	}
    //教师界面
	public void drawTeacher() {
		p13 = new JPanel();
		p14 = new JPanel();
		p15 = new JPanel();
		p16 = new JPanel();
		p17 = new JPanel();
		p18 = new JPanel();
		p19 = new JPanel();
		p2.removeAll();
		p2.repaint();
		Teacher tea = courseService.getTeacher(CourseControllerListener.nameInput);
		p2.setLayout(new GridLayout(8, 1));
		p2.add(p13);
		p2.add(p14);
		p2.add(p15);
		p2.add(p16);
		p2.add(p17);
		p2.add(p18);
		p2.add(p19);
		JLabel person1 = new JLabel("教职工号：" + tea.getTeaNo());
		JLabel person2 = new JLabel("姓名：" +  tea.getTeaName());
		JLabel person3 = new JLabel("性别：" +  tea.getTeaSex());
		JLabel person4 = new JLabel("年龄：" +  tea.getTeaAge());
		JLabel person5 = new JLabel("课程编号：" +tea.getCourse().getCouId());
		JLabel person6 = new JLabel("所教科目：" + tea.getCourse().getCouName());
		person1.setFont(new Font("Dialog", 1, 25));
		person2.setFont(new Font("Dialog", 1, 25));
		person3.setFont(new Font("Dialog", 1, 25));
		person4.setFont(new Font("Dialog", 1, 25));
		person5.setFont(new Font("Dialog", 1, 25));
		person6.setFont(new Font("Dialog", 1, 25));
		p14.add(person1);
		p15.add(person2);
		p16.add(person3);
		p17.add(person4);
		p18.add(person5);
		p19.add(person6);
		p2.revalidate();
	}	

	// 教师查看学生成绩界面
	public void getStudentGrade() {
		p2.removeAll();
		p2.repaint();
		p2.setLayout(new GridLayout(2, 1));
	
		p1.setLayout(new BorderLayout());
		tablePanel1=StudentJPanel.getStudentTablePanel(controllerListener.getCourseService().findAllStudent());
		p1.add(tablePanel1);
		p2.add(p1);
		System.out.println(2222222);
//		p1.updateUI();
	
		// p1.add(TzJPanel.getCourseTablePanel(controllerListener.getCourseService().getStudentGrade(stuNo)));
//		p1.add(StudentJPanel.getStudentTablePanel(controllerListener.getCourseService().findAllStudent()));
//		JButton b6 = new JButton("查询");
//		b6.addActionListener(controllerListener);
//		b6.setActionCommand("researchStuGrade");
//		JButton b7 = new JButton("查询");
//		b7.addActionListener(controllerListener);
//		b7.setActionCommand("confirmMax");
//		JLabel s2 = new JLabel("类型：");
//		JLabel s3 = new JLabel("类型：");
//		comboBox1 = new JComboBox<String>();// 创建一个下拉列表框comboBox1
//		comboBox1.addItem("班级号");
//		comboBox1.addItem("学号");
//		comboBox1.addItem("课程名称");
//		comboBox2 = new JComboBox<String>();// 创建一个下拉列表框comboBox2
//		comboBox2.addItem("最高分");
//		comboBox2.addItem("平均分");
//		comboBox2.addItem("最低分");
//		comboBox2.addItem("及格率");
//		p20 = new JPanel();
//		p21 = new JPanel();
//		p22 = new JPanel();
//		p23 = new JPanel();
//		p24 = new JPanel();
//		p20.setLayout(new GridLayout(4, 1));
//		p2.add(p20);
//		p20.add(p21);
//		p20.add(p22);
//		p20.add(p23);
//		p20.add(p24);
//		s2.setFont(new Font("Dialog", 1, 25));
//		s3.setFont(new Font("Dialog", 1, 25));
//		t1 = new JTextField(12);
//		t2 = new JTextField(12);
//		p21.add(s2);
//		p22.add(t1);
//		p22.add(comboBox1);
//		p22.add(b6);
//		p23.add(s3);
//		p24.add(t2);
//		p24.add(comboBox2);
//		p24.add(b7);
//		p2.revalidate();
		System.out.println(1111111);
	}
    //老师查看所教课程界面
	public void getTeaCou(String teaNo) {
		this.remove(p2);
	    p2=new JPanel();
		p2.removeAll();
		p2.repaint();
		p2.setLayout(new GridLayout(2, 1));
//		p2.add(p1);
		p1.setLayout(new BorderLayout());
		tablePanel2=CourseJPanel.getCourseTablePanel(controllerListener.getCourseService().getTeaCourse(teaNo));
        p1.add(tablePanel2);
        p2.add(p1);
		JButton b6 = new JButton("查询");
		b6.addActionListener(controllerListener);
		b6.setActionCommand("findCourse");
		JButton b7 = new JButton("确认选课");
		b7.addActionListener(controllerListener);
		b7.setActionCommand("confirmCourse");
		JLabel s2 = new JLabel("输入课程号：");
		p20 = new JPanel();
		p21 = new JPanel();
		p22 = new JPanel();	
		p20.setLayout(new GridLayout(4, 1));
		p2.add(p20);
		p20.add(p21);
		p20.add(p22);	
		s2.setFont(new Font("Dialog", 1, 25));
		 t1 = new JTextField(12);
		p22.add(t1);p22.add(b6); 
		sp2.setRightComponent(p2);// 右部显示界面
		p2.revalidate();
	}
    //教师录入、修改学生成绩界面
	public void getTeaStu(String teaNo) {
		
		p1.removeAll();
		p2.removeAll();
		p2.repaint();
		p2.setLayout(new GridLayout(2, 1));
//		p2.add(p1);
		p1.setLayout(new BorderLayout());
		// p1.add(TzJPanel.getCourseTablePanel(controllerListener.getCourseService().getStudentGrade(stuNo)));
		tablePanel = StudentJPanel.getStudentTablePanel(controllerListener.getCourseService().findTeaStu(teaNo));
		p1.add(tablePanel);
		p2.add(p1);
		JButton b6 = new JButton("成绩录入");
		b6.addActionListener(controllerListener);
		b6.setActionCommand("recGrade");

		JButton b7 = new JButton("确认修改");
		b7.addActionListener(controllerListener);
		b7.setActionCommand("confirmGrade");
		JLabel s2 = new JLabel("录入学生成绩：");
		JLabel s3 = new JLabel("修改学生成绩：");
		p20 = new JPanel();
		p21 = new JPanel();
		p22 = new JPanel();
		p23 = new JPanel();
		p24 = new JPanel();
		p20.setLayout(new GridLayout(4, 1));
		p2.add(p20);
		p20.add(p21);
		p20.add(p22);
		p20.add(p23);
		p20.add(p24);
		s2.setFont(new Font("Dialog", 1, 25));
		s3.setFont(new Font("Dialog", 1, 25));
		t1 = new JTextField(12);
		t2 = new JTextField(12);
		p21.add(s2);
		p22.add(t1);
		p22.add(b6);
		p23.add(s3);
		p24.add(t2);
		p24.add(b7);
		p2.revalidate();
	}

	public static void refreshGrade(List<Student> studentList) {
		System.out.println("测试——当前学生数量为：" + studentList.size());
		p1.remove(tablePanel);
		p1.add(StudentJPanel.getStudentTablePanel(studentList));
		p1.validate();
>>>>>>> refs/remotes/origin/master
		JOptionPane.showMessageDialog(p1, "重新加载数据成功！");
	}

	public static JTextField getT1() {
		return t1;
	}

	public static void setT1(JTextField t1) {
		TeacherFrame.t1 = t1;
	}

	public static JTextField getT2() {
		return t2;
	}

	public static void setT2(JTextField t2) {
		TeacherFrame.t2 = t2;
	}
    
	public CourseControllerListener getControllerListener() {
		return controllerListener;
	}
}
